package com.xquant.system.api;

import com.xquant.common.core.web.domain.AjaxResult;
import com.xquant.common.core.web.page.TableDataInfo;
import com.xquant.system.api.domain.SysOperLog;
import com.xquant.system.api.domain.TsysInterfaceLog;
import com.xquant.system.api.factory.RemoteLogFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.xquant.common.core.constant.SecurityConstants;
import com.xquant.common.core.constant.ServiceNameConstants;
import com.xquant.common.core.domain.R;
import com.xquant.system.api.domain.SysLogininfor;

/**
 * 日志服务
 *
 * @author xquant
 */
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService
{
    /**
     * 保存系统日志
     *
     * @param sysOperLog 日志实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/operlog")
    public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 保存访问记录
     *
     * @param sysLogininfor 访问实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/logininfor")
    public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     *
     * @param interfaceLog
     * @return
     */
    @PostMapping("/interfaceLog")
    public R<Boolean> saveImportLog(@RequestBody TsysInterfaceLog interfaceLog);

    @GetMapping( "/interfaceLog/icode/{id}")
    public R<Boolean> getInfoByICode(@PathVariable("id") String id);

    @DeleteMapping("/{ids}")
    public R<Boolean> remove(@PathVariable("ids") String[] ids);

    @PostMapping("/interfaceLog/queryLog")
    public TableDataInfo queryLog(@RequestBody TsysInterfaceLog tsysInterfaceLog);
}
